package com.feifei.controller;

import com.feifei.bean.Type;
import com.feifei.service.TypeService;
import com.feifei.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@CrossOrigin
@Controller
public class TypeController {
    @Autowired
    TypeService typeService;

    //获取项目类型
    @ResponseBody
    @RequestMapping("/type/getAllTypes")
    public Result getAllTypes(){
        Result result=new Result();
        List<Type> list= typeService.getAllTypes();
        if (list != null && list.size() != 0) {
            result.setStatus(true);
            result.setData(list);
            result.setMsg("查询成功");
        } else {
            result.setStatus(false);
            result.setData(null);
            result.setMsg("无数据");
        }
        return result;
    }
}
